#include <iostream>
#include <string>
#include "2_6_OwnDataStructs.h"


using namespace std;
int main()
{
    Sales_data data1, data2;
    double price = 0.0;

    cout << "Please input the BOOK`s ISBM units_sold and price" << endl;
    cin >> data1.bookNo >> data1.units_sold >> price;
    data1.revenue = data1.units_sold * price;
    
    cout << "Please input the BOOK`s ISBM units_sold and price" << endl;
    cin >> data2.bookNo >> data2.units_sold >> price;
    data2.revenue = data2.units_sold * price;


	if(data1.bookNo == data2.bookNo)
	{
		unsigned total_count = data1.units_sold + data2.units_sold;
		double total_revenue = data1.revenue + data2.revenue;
		cout << "all:" << total_revenue << endl;
		if(total_count != 0)
		{
			cout << "IBSN" << "\t" << "sale_count" << "\t" << "total" << endl;
			cout << data1.bookNo << "\t" << data1.units_sold << "\t\t" << data1.revenue << endl;
			cout << data2.bookNo << "\t" << data2.units_sold << "\t\t" << data2.revenue << endl;
			cout << "totla_count\ttotal_sales\tper_price" << endl;
			cout << total_count << "\t\t" << total_revenue <<"\t\t" << (total_revenue/total_count) << endl ;
			
		}else{
			cout << "sales zero book!";
		}
		
	}else{
		cerr << "the BOOK`s ISBM not the same!" << endl;
	}

    
    
    return 0;
}
